package com.jack.api

import okhttp3.OkHttpClient
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory

object ApiMgr {
    val api by lazy {
        buildRe().create(Api::class.java)
    }

    private fun buildRe() = with(Retrofit.Builder()) {
        addConverterFactory(GsonConverterFactory.create())
        baseUrl("https://www.wanandroid.com/")
        client(buildOk())
        build()
    }

    private fun buildOk(): OkHttpClient =
        with(OkHttpClient.Builder()) {
            build()
        }
}